﻿@model JuCheap.Core.Models.ViewModels.CompanyViewModel

@{
    ViewData["Title"] = "添加公司";
    Layout = "~/Views/Shared/_Layout_Content.cshtml";
}
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>添加公司</h5>
            <div class="ibox-tools">
                <a class="collapse-link">
                    <i class="fa fa-chevron-up"></i>
                </a>
            </div>
        </div>
        <div class="ibox-content">
            <form asp-controller="Company" asp-action="Add" class="form-horizontal" method="POST">
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="OrganizationId"></label>
                    <div class="col-sm-8">
                        <select id="OrganizationId" name="OrganizationId" class="form-control"></select>
                        <span asp-validation-for="OrganizationId"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="Name"></label>
                    <div class="col-sm-8">
                        <input asp-for="Name" class="form-control" placeholder="公司名称" />
                        <span asp-validation-for="Name"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="Address"></label>
                    <div class="col-sm-8">
                        <input asp-for="Address" class="form-control" placeholder="地址" />
                        <span asp-validation-for="Address"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="Contact"></label>
                    <div class="col-sm-8">
                        <input asp-for="Contact" class="form-control" placeholder="联系人" />
                        <span asp-validation-for="Contact"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="ContactPhoneNumber"></label>
                    <div class="col-sm-8">
                        <input asp-for="ContactPhoneNumber" class="form-control" placeholder="联系电话" />
                        <span asp-validation-for="ContactPhoneNumber"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="Status"></label>
                    <div class="col-sm-8">
                        <select name="Status" id="Status"
                                class="form-control" placeholder="状态">
                            <option value="1">驻场</option>
                            <option value="2">离场</option>
                        </select>
                        <span asp-validation-for="Status"></span>
                    </div>
                </div>
                
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-8">
                        <button class="btn btn-info" type="submit">保存</button>
                        <button class="btn btn-white" type="button" id="btnBack">返回</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
@section styles{
    <link href="~/js/plugins/select2/css/select2.css" rel="stylesheet" />
}

@section scripts{
    <environment names="Development">
        <script src="~/js/jquery.validate.js"></script>
        <script src="~/js/jquery.validate.unobtrusive.js"></script>
        <script src="~/js/base.js"></script>
    </environment>
    <environment names="Staging,Production">
        <script src="~/js/validate.min.js" asp-append-version="true"></script>
        <script src="~/js/base.min.js" asp-append-version="true"></script>
    </environment>
    <script src="~/js/plugins/select2/js/select2.js"></script>
    <script src="~/js/BindSelect.js"></script>
    <script>
        $("#btnBack").bind("click", function (e) {
            XPage.GoTo(e.target, "@Url.Action("Index")");
        });
      
       
        //var url = "/Organization/GetOrganizations";
        //$.getJSON(url, function (data) {
        //    var control = $('#OrganizationId');
        //    control.empty();//清空下拉框
        //    $.each(data, function (i, item) {
        //        for (var j = 0; j < item.length; j++) {
        //            control.append("<option value='" + item[j].id + "'>&nbsp;" + item[j].text + "</option>");
        //        }
        //    });
        //});
        BindSelect("OrganizationId", "/Organization/GetOrganizations");

     
    </script>
}

